#ifndef SRC_CORE_ASYNC_LISTENER_IMPL_H_
#define SRC_CORE_ASYNC_LISTENER_IMPL_H_

#include "core/async_listener.h"

namespace vz {

class AsyncListenerImpl : public AsyncListener {
 public:
  AsyncListenerImpl(AsyncSocket* socket);
  virtual ~AsyncListenerImpl();

  bool Start(SocketAddress &address,
             int listen_backlog = DEFAULT_LISTEN_BACKLOG);

 private:
  Ptr SharedFromThis();

  void OnReadEvent(AsyncSocket* async_socket);
  void OnCloseEvent(AsyncSocket* async_socket, int errcode);

 private:
  scoped_ptr<AsyncSocket> socket_;
};

}  // namespace vz

#endif  // SRC_CORE_ASYNC_LISTENER_IMPL_H_



